﻿<%@ Page Language="C#" AutoEventWireup="true"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    System.Collections.Generic.List<AD.Model.NetShopMod> shops;
    System.Collections.Generic.List<AD.Model.KeyWordsMod> keywords;
    string spread = "";
    string engine = "";
   public string wd = "";
    const string SP_SHOP = "2";
    const string SP_KEYWORDS = "1";
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
        * 推广类型
        * 
        * 搜索关键字推广 = 1,
        * 搜索网店关键字推广 = 2,
        */
        spread = Request.QueryString["spType"];
        
        /*
         * 搜索引擎类型
         * 
         * Baidu = 1,
         * Google = 2,
         * Sogo = 3,
         */

        /*
        * 网店推广类型
        * 
        * Taobao = 1,
        * Paipai = 2,
        */
        engine = Request.QueryString["engineType"];
        
        /*
         * 关键字中文必须Url GBK编码 
         */
        wd = Request.QueryString["wd"];
        if (!string.IsNullOrEmpty(spread) && !string.IsNullOrEmpty(engine) && !string.IsNullOrEmpty(wd))
        {
            if (spread.Equals(SP_KEYWORDS))
            {
                QuerySearchKeyword(wd, engine);
            }
            else if (spread.Equals(SP_SHOP))
            {
                QueryShopKeyword(wd, engine);
            }
        }
        else {
            engine = "";
            spread = "";
        }
    }

    void QuerySearchKeyword(string keyword, string engine)
    {
        System.Collections.Generic.List<AD.Model.KeyWordsMod> tmp = AD.BLL.KeyWordsBLL.Query(keyword, engine);
        if (tmp != null && tmp.Count > 0)
        {

            keywords = tmp;
        }
    }
    
    void QueryShopKeyword(string keyword, string engine)
    {
        System.Collections.Generic.List<AD.Model.NetShopMod> tmp = AD.BLL.NetShopsBLL.Query(keyword, engine);
        if (tmp != null && tmp.Count > 0)
        {
            shops = tmp;
        }
    }
    void Exch(System.Collections.Generic.List<AD.Model.KeyWordsBaseMod> list, int i, int j)
    {
        AD.Model.KeyWordsBaseMod swap = list[i];
        list[i] = list[j];
        list[j] = swap;
    }
    
    void Shuffle(System.Collections.Generic.List<AD.Model.KeyWordsBaseMod> list)
    {
        int N = list.Count;
        for (int i = 0; i < N; i++)
        {
            int r = (new Random().Next(0, N));
            Exch(list, i, r);
        }
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <%if (!string.IsNullOrEmpty(spread) && spread.Equals("2")) {%>
    <%if (engine.Equals("2"))
      { %>
        <link rel="stylesheet" href="http://static.paipaiimg.com/search/search_2012_v1.css?t=20120222" type="text/css" media="screen" />
        <link rel="stylesheet" href="http://static.paipaiimg.com/common/paipai.css?t=20120214" type="text/css" media="screen" id="staticPreload" data-preload="search/search_2012_v1.css?t=20120222" />
      <%}
      else if (engine.Equals("1"))
      {%><link rel="stylesheet" href="http://a.tbcdn.cn/apps/e/tsrp/120301/search.css"/>
      <%} }%>
</head>
<body style="margin-top:5px">
<table cellSpacing=0 cellPadding=0 width="30%" align=right>
<%if (spread.Equals(SP_KEYWORDS)){%>
<%if (keywords!=null)foreach (AD.Model.KeyWordsMod key in keywords)
  {%>
<tr>
<td style="PADDING-RIGHT: 10px" align=left>
<div style="BORDER-LEFT: #e1e1e1 1px solid; PADDING-LEFT: 10px; WORD-WRAP: break-word; WORD-BREAK: break-all">
<div id="ec_im_container"> 
<div class="r" id="bdfs0" style="width:245px;">                  
<a id="dfs0" href="<%=key.AdUrl %>" onmouseover="return ss('链接至 www.jinlanad.com')" onmouseout="cs()" target="_blank">
<font size="3"><%=key.AdTitle.Replace(wd, "<font color=#c60a00>" + wd + "</font>")%></font>
</a>
<br/>
<a id="dfs0" style="text-decoration:none;" href='<%=key.AdUrl %>' target='_blank' >
<font size="-1" color="#000000">
<%=key.AdDescribe_First.Replace(wd, "<font color=#c60a00>" + wd + "</font>")%><br/>
<%=key.AdDescribe_Second.Replace(wd, "<font color=#c60a00>" + wd + "</font>")%>
</font>
<br/>
<font size="-1" color="#008000"><%=key.AdUrl.Replace("http://", "") %></font>
</a>                    
</div>
<br/>
</div>
</div>
</td>
</tr>
<%} %>
<%}else
  {%>
<%if (shops != null) foreach (AD.Model.NetShopMod shop in shops){%>
<tr><td>
<%if(!string.IsNullOrEmpty(engine) && engine.Equals("1")){%>
<div class="mall" id="J_mall">
<ul class="list-view-enlarge">
<li class="list-item">
<h3 class="summary">
<a href="<%=shop.Url%>" target="_blank" class="EventCanSelect" id="p_ProductName"><%=shop.ProductName.Replace(wd,"<span class=H >"+wd+"</span>")%></a></h3>
<div class="photo">
<a href="<%=shop.Url%>" target="_blank"><span><img src="<%=shop.ProductPicture %>" alt=""/></span></a>
<a class="antispam" href="<%=shop.Url%>" target="_blank" title="举报该宝贝"></a></div>
<%if (shop.IsLogo)
  { %>
<a class="mall-icon" target="_blank" href="<%=shop.Url%>" title="天猫"></a>
<%} %>
<ul class="attribute" ><li class="seller">
<a href="<%=shop.Url%>" target="_blank"><%=shop.ShopName %></a>
<span class="J_WangWang"></span></span>
<span class="shopinfo"></span>
</li><li class="shipping">运费：<span><%=shop.Shipping%></span></li>
<li class="place"><span><%=shop.Region%></span></li><li class="price"><em><%=shop.ProductPrice%></em> <span >最近成交<span><%=shop.CommitCount%></span>笔</span></li></ul>
<div class="legend2">
<span class="xb">
<%if(shop.IsProtection){ %>
<a id="p_IsProtection" target="_blank" title="卖家承诺消费者保障服务" class="xb-as-fact" href="http://www.taobao.com/go/act/315/xfzbz_rsms.php"><span>消费者保障</span></a>
<%} %>
<%if(shop.IsRetreat) {%>
<a id="p_IsRetreat" target="_blank" title="卖家承诺7天无理由退换货" class="xb-sevenday-return" href="http://www.taobao.com/go/act/315/xbqt090304.php"><span>七天退换</span></a>	
<%} %>
<%if(shop.IsGenuineProtection) {%>
<a id="p_IsGenuineProtection" target="_blank" title="卖家承诺正品保障" class="xb-quality_item" href="http://www.taobao.com/go/act/315/xfzbz_zpbz.php"><span>正品保障</span></a></span> 
<%} %>
<%if(shop.IsAllDayShipping){ %>
<a id="p_IsAllDayShipping" target="_blank" title="卖家承诺24小时发货" class="xb-thunder-delivery" href="http://www.taobao.com/go/act/315/xb_20100707.php?ad_id=&am_id=1300268931aef04f0cdc&cm_id=&pm_id=#shandian"><span>24小时发货</span></a>
<%} %>
<%if(shop.IsPublicbaby) {%>
<a id="p_IsPublicbaby" href="http://gongyi.taobao.com" class="lovebaobei" title="公益宝贝" target="_blank">公益宝贝</a>
<%} %>
<%if(shop.IsCreditCard){ %>
<a id="p_IsCreditCard" href="http://www.taobao.com/go/act/sale/kadepay.php?ad_id=&am_id=&cm_id=14001249574b437a411d&pm_id=" title="信用卡" class="creditcard" target="_blank">信用卡</a>
<%} %>
<%if(shop.IsCashonDelivery) {%>
<a id="p_IsCashonDelivery" href="http://www.taobao.com/go/act/sale/syzxfw_090602_qcz.php" class="COD" title="货到付款" target="_blank">货到付款</a>	</div>
<%} %>
</li>
</ul>
</div>
<%} else if(!string.IsNullOrEmpty(engine) && engine.Equals("2")){%>
<div class="item_list_table img-view" >
<ul id="itemList" class="group">
<li itemscope="itemscope" itemtype="http://schema.org/Product" PromoteFlag="">
<div class="img_effect">
<div class="item-show">
<div class="photo">
<a target="_blank" href="<%=shop.Url%>"><img src="<%=shop.ProductPicture %>" height="200" width="200" alt="" /></a>
</div>
<h3>
<a target="_blank" href="<%=shop.Url %>"><span class="legend-shop-" title=""></span></a>
<%if (shop.IsLogo)
  { %>
<a class="author-icon-1" target="_blank" href="http://shop.qq.com?PTAG=20058.2.3" lg="6007"></a>
<%} %>
<a target="_blank" href="#" itemprop="name" id="A1"><%=shop.ShopName%></a>
</h3>
<div class="price">
<p><em class="pp_price">&yen;<span><%=shop.ProductPrice %></span></em><cite><ins></ins></cite>
</p>
<span class="wpa"><q><a id="pQQ" href="tencent://message/?uin=<%=shop.QQ %>&Site=www.jinlanad.com&Menu=yes" uin="<%=shop.QQ %>" title="点击直接联系商家">
<img src="images/state_1_1.gif" /></a></q></span>
</div>
<div id="goodsTips" class="attribute">
<div class="vip_content">
<a target="_blank" href="<%=shop.Url %>"><p class="vip_turn" onmouseover="showGoodMsgFloat(this)"><span></span></p></a>
</div>
<a id="A2" class="legend-icon-1" target="_blank" href="http://www.paipai.com/trust/plan/index.shtml" title="已加入诚信保证计划，卖家承诺先行赔付。" lg="6006" pos="1"></a>
<a id="A3" class="legend-icon-" target="_blank" href="http://www.paipai.com/trust/plan/index.shtml?tab=3" title="已加入诚信保证计划，卖家承诺7天无理由免邮换货。" lg="6006" pos="5"></a>
<%if (shop.IsRetreat)
  {%>
<a class="legend-icon-2" target="_blank" href="http://www.paipai.com/trust/plan/index.shtml?tab=4" title="已加入诚信保证计划，卖家承诺7天无理由退换货。" lg="6006" pos="2"></a>
<%} %>
<a class="legend-icon-3" target="_blank" href="http://www.paipai.com/trust/plan/index.shtml?tab=5" title="已加入诚信保证计划，卖家承诺诚保代充。" lg="6006" pos="3"></a>
<a id="A4" class="legend-icon-" target="_blank" href="http://www.paipai.com/trust/plan/index.shtml?tab=6" title="已加入诚信保证计划，卖家承诺假一赔三。" lg="6006" pos="4" ></a>
<a id="A5" class="legend-icon-" target="_blank" href="http://www.paipai.com/trust/plan/index.shtml?tab=8" title="已加入诚信保证计划，卖家承诺16点前付款12小时内快速发货。" lg="6006" pos="6"></a>
<a class="legend-icon-" target="_blank" href="http://help.paipai.com/content/help_1708.shtml" title="支持自动充值交易，付款后自动充值到帐。" lg="6006" pos="7"></a>					
<a class="cash-delivery-" target="_blank" href="http://help.paipai.com/content/help_20318.shtml" title="该商品支持货到付款，请自行与卖家沟通。"></a>
<a class="vouchers-" target="_blank" href="http://promote.paipai.com/2008/10/coupons/help.shtml" title="支持红包折价交易，使用一定面值红包可优惠购买。" lg="6005"></a>
<a class="auto-ship-" target="_blank" href="http://help.paipai.com/content/help_21101.shtml" title="支持自动发货交易，付款后立即拿到卡号密码。">虚拟</a>
<a class="validcloth-" target="_blank" href="http://help.paipai.com/content/help_20119.shtml" title="裳品廊，实物拍摄，精品女装，品质保证。"></a>
<span class="total">售出<span id="p_CommitCount"><%=shop.CommitCount%></span>件</span>
</div>
</div>
</div>
</li>
</ul>
</div>
<%}%>
</td></tr>
<%} %>
<%} %>
<tr>
<td>
<div class="r">
<div style="background:#EFF2FA;overflow:hidden;padding:0 3px;line-height:29px;height:30px;word-break:normal;">
<a href="http://www.jinlanad.com/" style="font-size:16px" target="_blank">来金兰推广您的产品&gt;&gt;</a>
</div>
</div>
<br>
</table>
</body>
</html>